package com.anssy.voteballot.utils;

import android.app.Activity;

import com.luck.picture.lib.PictureSelector;
import com.luck.picture.lib.config.PictureConfig;
import com.luck.picture.lib.config.PictureMimeType;

public class PictureSelectorUtils {

    /**
     * pictureSelector配置
     */
    public static void configPicSelector(Activity activity) {
        PictureSelector.create(activity)
                .openGallery(PictureMimeType.ofImage())
                .maxSelectNum(10)// 最大图片选择数量
                .minSelectNum(1)// 最小选择数量
                .isPreviewImage(true)// 是否可预览图片
                .isCompress(true)// 是否压缩
                .imageEngine(GlideEngine.createGlideEngine()) // 请参考Demo GlideEngine.java
                .forResult(PictureConfig.CHOOSE_REQUEST);
    }

    /**
     * pictureSelector配置
     */
    public static void configVideoSelector(Activity activity) {
        PictureSelector.create(activity)
                .openGallery(PictureMimeType.ofVideo())
                .maxSelectNum(1)// 最大图片选择数量
                .minSelectNum(1)// 最小选择数量
                .isPreviewImage(true)// 是否可预览图片
                .isCompress(true)// 是否压缩
                .imageEngine(GlideEngine.createGlideEngine()) // 请参考Demo GlideEngine.java
                .forResult(PictureConfig.CHOOSE_REQUEST);
    }

    /**
     * pictureSelector配置
     */
    public static void configAudioSelector(Activity activity) {
        PictureSelector.create(activity)
                .openGallery(PictureMimeType.ofAudio())
                .maxSelectNum(1)// 最大图片选择数量
                .minSelectNum(1)// 最小选择数量
                .isPreviewImage(true)// 是否可预览图片
                .isCompress(true)// 是否压缩
                .imageEngine(GlideEngine.createGlideEngine()) // 请参考Demo GlideEngine.java
                .forResult(PictureConfig.CHOOSE_REQUEST);
    }
}
